home *** CD-ROM | disk | FTP | other *** search
- /*
- sprlib.c
- */
-
- #include <stdio.h>
- #include <spr.h>
- #include <ryosuke.h>
- #include "usrlib.h"
-
- // static int dispnum = 221; // ( (1/60)*1000*1000 (micro sec) - 32 ) / 75
- static int dispnum = 221;
- static int _16spr = 0; // 16色スプライトの枚数
- // (0..896) (のこりは32K色スプライトになる)
-
- void sp_init(int _dispnum)
- // dispnum:表示する枚数
- {
- dispnum = _dispnum;
- SPR_init();
- SPR_display(1,dispnum);
- }
-
- void sp_end()
- {
- SPR_display(0,dispnum);
- }
-
- void sp_16colspr(int n)
- {
- _16spr = n;
- }
-
- void sp_def(int patn, char *pattern)
- // patn : 0..895
- {
- if (patn < _16spr) {
- SPR_define(0, 128+patn, 1,1, pattern);
- } else {
- SPR_define(1, 128+_16spr+(patn-_16spr)*4, 1,1, pattern);
- }
- }
-
- void sp_pltblk(int pltblkn, char *pltblk)
- // pltblkn : 0..255
- {
- SPR_setPaletteBlock(256+pltblkn, 1, pltblk);
- }
-
- void sp_put(int index, int x, int y, int patn, int pltblk)
- // index : 0..1023 (番号が小さいほど優先順位が高い)
- // pltblk : 0..255 32K 色スプライトの場合は無効
- {
- if (patn < _16spr)
- SPR_setAttribute((dispnum-1-index), 1,1, 128+patn, 0x8000 | (256+pltblk));
- else
- SPR_setAttribute((dispnum-1-index), 1,1, 128+_16spr+(patn-_16spr)*4, 0);
- SPR_setPosition(0, (dispnum-1-index), 1,1, x,y);
- }
-
-
- void sp_erase(int index, int num)
- {
- if (num>0)
- SPR_setAttribute((dispnum-index-num),num,1,0,1<<13);
- }
-
-
- /* end of sprlib.c */
-